home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _D1CCCFF1D24C49DAB1A22D6676879569 < prev    next >
Text File  |  2005-03-23  |  982b  |  48 lines

  1. //simple shader to clip any pixels with a Z coordinate below the water plane
  2. //does not apply lights
  3. //applies vertex diffuse colors and texture sampling
  4. //must be used with clipZ2.psh
  5. //Luke Lenhart
  6. //(C)2004-2005 Digipen Institute of Technology
  7.  
  8. //world,view,projection transform
  9. float4x4 matWorldViewProj;
  10. float4x4 matWorld;
  11.  
  12. //shader input
  13. struct VS_INPUT
  14. {
  15.     float4 Pos : POSITION;
  16.     float2 Tex0 : TEXCOORD0;
  17.     float4 Clr : COLOR0;
  18. };
  19.  
  20. //shader output
  21. struct VS_OUTPUT
  22. {
  23.     float4 Pos0 : POSITION;
  24.     float PosZ : TEXCOORD1;
  25.     float2 Tex0 : TEXCOORD0;
  26.     float4 Clr : COLOR0;
  27. };
  28.  
  29. //shader code
  30. VS_OUTPUT VShader(VS_INPUT In)
  31. {
  32.     VS_OUTPUT Out;
  33.     
  34.     //copy tex coord
  35.     Out.Tex0=In.Tex0;
  36.     
  37.     //calc transformed position
  38.     Out.Pos0=mul(matWorldViewProj,In.Pos);
  39.     float4 wPos=mul(matWorld,In.Pos);
  40.     Out.PosZ=wPos.z;
  41.     
  42.     //copy color
  43.     Out.Clr=In.Clr;        
  44.         
  45.     //spit out the results
  46.     return Out;
  47. }
  48.